/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package chat.MsgEvent;

import java.util.EventObject;

/**
 *
 * @author spider391Tang
 */
public class MsgPostEvent extends EventObject{
    int id;
    String author;
    String postMsg;
    public String getAuthor(){
        return author;
    }
    public String getPostMsg(){
        return postMsg;
    }
     public int getId()
     {
         return id;
     }

    public MsgPostEvent(String msg) {
        super(msg);
        //Message 101<Student1>: "This is a test".    <-- The server sends "/msg 101 Student1 This is a test".
        String[] names = msg.split(" ");
        id = Integer.parseInt(names[0]);
        author = names[1];
        postMsg = msg.substring(names[0].length()+1+names[1].length()+1);
    }
}
